﻿using System;
using System.Collections.Generic;
using NHibernate;
using YunBox2.Contracts;
using YunBox2.Contracts.Core;
using YunBox2.Contracts.FoundationModels;
using YunBox2.Server.Core;

namespace YunBox2.Server.Foundation
{
    public class UOMBiz:BizBase<UOM>
    {
        public UOMBiz(ISession session,User user):base(session,user)
        {
            
        }

        public bool InitSystemUOM()
        {
            var tran = Session.BeginTransaction();
            try
            {
                Session.Save(UOM.CentiMeter);
                Session.Save(UOM.Millimeter);
                Session.Save(UOM.Inch);
                Session.Flush();
                tran.Commit();
                return true;
            }
            catch (Exception)
            {
                tran.Rollback();
                return false;
            }

        }
    }
}